﻿package net.wangit.view.element.component;

import net.wangit.Row;
import net.wangit.context.ActionContext;
import net.wangit.support.AbstractElementWriter;
import net.wangit.view.element.ElementComponent;
import net.wangit.view.element.util.ElementUtil;
import net.wangit.view.util.Html;

public class PasswordElementWriter extends AbstractElementWriter {

	public PasswordElementWriter() {
	}

	protected void writeText(ActionContext actioncontext,
			StringBuffer stringbuffer, ElementComponent elementcomponent,
			Row row1) {
	}

	protected void writeTextWithValue(ActionContext ac, StringBuffer html,
			ElementComponent ec, Row row) {
		writeText(ac, html, ec, row);
	}

	protected void writeControl(ActionContext ac, StringBuffer html,
			ElementComponent ec, Row row) {
		html.append("<input type=\"password\" name=\"").append(
				ElementUtil.getAlias(ec)).append("\"");
		Html.setAttribute(html, ElementUtil.resolveCustom(ac, ec, row));
		Html.setCss(html, ec.getCss(), "E1");
		Html.setTitle(html, ElementUtil.resolveTitle(ac, ec, row));
		Html.setStyleWithWidth(html, ec.getWidth());
		Html.setMaxLength(html, ec.getMaxLength());
		html.append("/>");
	}

	protected void writeReadOnlyControl(ActionContext ac, StringBuffer html,
			ElementComponent ec, Row row) {
		writeText(ac, html, ec, row);
	}

	protected void writeDisabledControl(ActionContext ac, StringBuffer html,
			ElementComponent ec, Row row) {
		writeText(ac, html, ec, row);
	}

	protected void writeHidden(ActionContext ac, StringBuffer html,
			ElementComponent ec, Row row) {
		writeText(ac, html, ec, row);
	}
}
